<div class="main-content">
    <div class="section__content section__content--p20">
        <div class="container-fluid">
            <div class="row m-b-30">
                <div class="col-lg-12">
                    <div class="overview-wrap">
                        <h2 class="title-1">友情链接编辑</h2>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <strong>友情链接编辑</strong>
                        </div>
                        <div class="card-body">
                            <form class="form-horizontal" role="form" name="form" id="form" method="post"
                                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh"
                                  action="index.php?r=admin/friendlink/edit">
                                <input type="hidden" name="friendlink_id" value="<?php echo $id; ?>"/>
                                <input type="hidden" name="YII_CSRF_TOKEN" value="<?php echo Yii::app()->request->csrfToken; ?>"/>


                                <div class="form-group">
                                    <label class=" form-control-label">链接类型</label>
                                    <div>
                                        <label class="control-label">
                                            <?php
                                            if ($friendlink['linktype'] == 1) {
                                                ?>
                                                <input type="radio" name="linktype" value="1" checked="checked"/>文字&nbsp;&nbsp;
                                                <input type="radio" name="linktype" value="2"/>图片
                                                <?php
                                            } else {
                                                ?>
                                                <input type="radio" name="linktype" value="1"/>文字&nbsp;&nbsp;
                                                <input type="radio" name="linktype" value="2" checked="checked"/>图片
                                                <?php
                                            }
                                            ?>
                                        </label>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">网站名称</label>
                                    <input type="text" name="webname" value="<?php echo $friendlink['webname']; ?>"
                                           class="form-control"/>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">地址</label>
                                    <input type="text" name="weburl" value="<?php echo $friendlink['weburl']; ?>"
                                           class="form-control"/>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">Logo地址</label>
                                    <input type="text" name="logourl" value="<?php echo $friendlink['logourl']; ?>"
                                           class="form-control"/>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">关键字</label>
                                    <input type="text" name="keyword" value="<?php echo $friendlink['keyword']; ?>"
                                           class="form-control"/>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">排序</label>
                                    <input type="number" class="form-control"  name="seq"
                                           value="<?php echo $friendlink['seq']; ?>"/>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">是否审核</label>
                                    <div>
                                        <label class="control-label">
                                            <?php
                                            if ($friendlink['isauth'] == 1) {
                                                ?>
                                                <input type="checkbox" name="isauth" value="1" checked="checked"/>
                                                <?php
                                            } else {
                                                ?>
                                                <input type="checkbox" name="isauth" value="1"/>
                                                <?php
                                            }
                                            ?>
                                        </label>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <button  type="submit" name="submit" id="submit" class="btn btn-primary btn-lg btn-block">保存</button>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        initPage();
    });
    function initPage() {
        $('#form').bootstrapValidator();
        $('#form').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (formData, jqForm, options) {
                return $('#form').data('bootstrapValidator').isValid();
            },
            success: function (res) {
                if (message(res)) {
                    window.location.href = "index.php?r=admin/friendlink/index";
                }
            }
        });
    }

</script>